package com.example.train.eurekaprovide.api;

import com.example.train.eurekaprovide.entity.Employee;
import com.example.train.eurekaprovide.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EmployeeController {

    @Autowired
    EmployeeService employeeService;

    @GetMapping("/employee/{id}")
    public Employee getEmployee(@PathVariable("id") Integer id) {
        return employeeService.selectById(id);
    }

    @GetMapping("/employee/list")
    public List<Employee> list() {
        return employeeService.selectAll();
    }
}
